package com.huangcy.gulimall.cart.service;

import com.huangcy.gulimall.cart.vo.Cart;
import com.huangcy.gulimall.cart.vo.CartItem;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * @program: gulimall
 * @description:
 * @author: huangcy
 * @create: 2022-08-31 10:20
 **/
public interface CartService {
    /**
     * 将某个商品添加到购物车
     *
     * @param skuId
     * @param num
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    CartItem addToCart(Long skuId, Integer num) throws ExecutionException, InterruptedException;

    /**
     * 获取购物车中的某个购物项
     *
     * @param skuId
     * @return
     */
    CartItem getCartItem(Long skuId);

    /**
     * @return com.huangcy.gulimall.cart.vo.Cart
     * @MethodName getCart
     * @Description 获取购物车
     * @Author huangcy
     * @Date 2022/8/31 15:59
     */
    Cart getCart() throws ExecutionException, InterruptedException;

    /**
     * 清除购物车
     * @param cartKey
     */
    public void clearCart(String cartKey);

    /**.
     * 勾选购物项
     * @param skuId
     * @param check
     */
    void checkItem(Long skuId, Integer check);

    /**.
     * 改变购物车数量
     * @param skuId
     * @param num
     */
    void changeItemCount(Long skuId, Integer num);

    /**.
     * 删除购物项
     * @param skuId
     */
    void deleteItem(Long skuId);

    List<CartItem> getUserCartItems();
}
